package net.hn.hnms.biz.plan.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import net.hn.hnms.biz.plan.domain.ExecutionCost;
import net.hn.hnms.biz.plan.vo.ExecutionCostVO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

public interface ExecutionCostMapper extends BaseMapper<ExecutionCost> {

    @Select("<script>" +
            " select " +
            " sum(cost_material) as  totalCostMaterial," +
            " sum(cost_recycle) as  totalCostRecycle," +
            " sum(cost_water) as  totalCostWater," +
            " sum(cost_power) as  totalCostPower" +
            " from execution_cost " +
            " where del_flag ='0' and  mine_code =  #{mineCode} " +
            "</script>")
    ExecutionCostVO selectExecutionCostTotalByMineCode(@Param("mineCode") String mineCode);

    @Select("<script>" +
            " select " +
            " sum(cost_material) as  totalCostMaterial," +
            " sum(cost_recycle) as  totalCostRecycle," +
            " sum(cost_water) as  totalCostWater," +
            " sum(cost_power) as  totalCostPower" +
            " from execution_cost " +
            " where del_flag ='0' and  company_code =  #{mineCode} " +
            "</script>")
    ExecutionCostVO selectExecutionCostTotalByCompanyCodeOrName(@Param("mineCode") String mineCode);
}
